{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "# Reference: https://jupyterbook.org/interactive/hiding.html\n",
    "# Use {hide, remove}-{input, output, cell} tags to hiding content\n",
    "\n",
    "import sys\n",
    "import os\n",
    "if not any(path.endswith('textbook') for path in sys.path):\n",
    "    sys.path.append(os.path.abspath('../../..'))\n",
    "from textbook_utils import *"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Exercises"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Revisit the creation of the test-train split, and use `train_test_split` provided in `scikit-learn` to randomly divide the data into two parts. Notice that with this method you can separate the predictor variable and the explanatory variables into `X` and `y` objects."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- We chose a loss function that outputs a bigger loss when the model \n",
    "  overestimates donkey weights.\n",
    "  But, sometimes we want the opposite: we want a bigger loss when the model\n",
    "  *underestimates* the weights.\n",
    "  For example, it's more harmful to prescribe too little of an\n",
    "  antibiotic. If an infection isn't completely wiped out, it can acquire\n",
    "  resistance to the antibiotic and re-emerge.\n",
    "  Create a loss function called `bio_loss` that penalizes underestimates of \n",
    "  model weights, and re-fit our model to it.\n",
    "  How does this new loss function change the model's predictions and errors?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Fit a model that only uses the one-hot encoded `BCS` variable.\n",
    "  Plot the model parameters on a scatter plot, then compare the scatter plot\n",
    "  to a box plot of `Weight` vs. `BCS`. What do you notice?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Re-fit our final model on the training data, but instead of dropping `BCS_3.0`, drop `BCS_4.0` instead. How does this change the model parameters?Why is this new model equivalent to the old one?"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Tags",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
